#!/usr/bin/env node

const fs  = require('fs'),
      src = process.argv[2],  //源文件
      dst = process.argv[3]; //目标文件

let srcStream = fs.createReadStream(src),
    dstStream = fs.createWriteStream(dst);

srcStream.pipe(dstStream);
dstStream.on('close',()=>{
  fs.chmodSync(dst,fs.statSync(src).mode);
});

//fs.createReadStream(src).pipe(fs.createWriteStream(dst));

//实现权限的复制
//fs.chmodSync(dst,fs.statSync(src).mode);

